﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;

namespace NuGet.Enterprise.Server.Configuration
{
    public sealed class BuildStoreConnectionEnumerator
        : IEnumerator, IEnumerator<BuildStoreConnectionSettings>
    {
        private BuildStoreConnectionCollection _instance;

        private int _index = -1;

        internal BuildStoreConnectionEnumerator(BuildStoreConnectionCollection instance)
        {
            _instance = instance;
        }

        BuildStoreConnectionSettings IEnumerator<BuildStoreConnectionSettings>.Current
        {
            get { return _instance[_index]; }
        }

        object IEnumerator.Current
        {
            get { return _instance[_index]; }
        }

        public bool MoveNext()
        {
            return (++_index < _instance.Count);
        }

        public void Reset()
        {
            _index = -1;
        }

        public void Dispose()
        {
            // nothing to do
        }
    }
}